﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:p="clr-namespace:Lithnet.Acma.Presentation"
                    xmlns:c="clr-namespace:Lithnet.Common.Presentation;assembly=Lithnet.Common.Presentation">

    <HierarchicalDataTemplate DataType="{x:Type p:RuleGroupViewModel}">
        <HierarchicalDataTemplate.ItemsSource>
            <MultiBinding>
                <MultiBinding.Converter>
                    <c:CompositeCollectionConverter />
                </MultiBinding.Converter>
                <Binding Path="Rules" />
            </MultiBinding>
        </HierarchicalDataTemplate.ItemsSource>

        <p:TreeViewItemControl>
            <p:TreeViewItemControl.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Add">
                        
                        <MenuItem Header="Object change rule"
                                  Command="{Binding Commands.AddObjectChangeRule}"/>
                        <MenuItem Header="Attribute change rule"
                                  Command="{Binding Commands.AddAttributeChangeRule}" />
                        <MenuItem Header="Event rule"
                                  Command="{Binding Commands.AddEventRule}" />
                        <Separator />
                        <MenuItem Header="Attribute presence rule"
                                  Command="{Binding Commands.AddAttributePresenceRule}" />
                        <MenuItem Header="Attribute value comparison rule"
                                  Command="{Binding Commands.AddValueComparisonRule}" />
                        <MenuItem Header="Advanced value comparison rule"
                                  Command="{Binding Commands.AddAdvancedComparisonRule}" />
                        <Separator />
                        
                        <MenuItem Header="Group"
                                  Command="{Binding Commands.AddRuleGroup}" />
                    </MenuItem>

                    <MenuItem Header="Delete"
                              Command="{Binding Commands.DeleteRuleGroup}" />

                    <Separator />
                    <MenuItem Header="Cut"
                              Command="{Binding Commands.Cut}" />
                    <MenuItem Header="Copy"
                              Command="{Binding Commands.Copy}" />
                    <MenuItem Header="Paste"
                              Command="{Binding Commands.Paste}" />

                </ContextMenu>
            </p:TreeViewItemControl.ContextMenu>
        </p:TreeViewItemControl>

    </HierarchicalDataTemplate>

    <HierarchicalDataTemplate DataType="{x:Type p:RuleViewModel}">
        <p:TreeViewItemControl>
            <p:TreeViewItemControl.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Delete..."
                              Command="{Binding Commands.DeleteRule}" />
                    <Separator />
                    <MenuItem Header="Cut"
                              Command="{Binding Commands.Cut}" />
                    <MenuItem Header="Copy"
                              Command="{Binding Commands.Copy}" />
                    <MenuItem Header="Paste"
                              Command="{Binding Commands.Paste}" />
                </ContextMenu>
            </p:TreeViewItemControl.ContextMenu>
        </p:TreeViewItemControl>
    </HierarchicalDataTemplate>
</ResourceDictionary>